[id].vue 46 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278
  1. <template>
  2. <!-- 页面头部 -->
  3. <HomePageHead></HomePageHead>
  4. <!-- 导航栏 -->
  5. <HomePageNavigation></HomePageNavigation>
  6. <!-- 面包屑导航 -->
  7. <div class="breadcrumb-box">
  8. <div class="inner">
  9. <span class="location">当前位置:</span>
  10. <el-breadcrumb :separator-icon="ArrowRight">
  11. <el-breadcrumb-item>
  12. <NuxtLink to="/">首页</NuxtLink>
  13. </el-breadcrumb-item>
  14. <el-breadcrumb-item v-if="parent_children_count > 0">
  15. <NuxtLink :to="`/${parent_pinyin}/index.html`"> {{ parent_name }}</NuxtLink>
  16. </el-breadcrumb-item>
  17. <el-breadcrumb-item v-if="parent_children_count == 0">
  18. <NuxtLink :to="`/${parent_pinyin}/list-1.html`"> {{ parent_name }}</NuxtLink>
  19. </el-breadcrumb-item>
  20. <el-breadcrumb-item class="phone_breadcrumb_text">{{ routeNewsTtitle }}</el-breadcrumb-item>
  21. </el-breadcrumb>
  22. </div>
  23. </div>
  24. <!-- 资讯列表 -->
  25. <div class="newsDetail">
  26. <div class="inner">
  27. <div class="innerLeft">
  28. <div class="LeftTop">
  29. <h1>{{ newsDetail.title }}</h1>
  30. <p>
  31. 来源: <span>{{ newsDetail.copyfrom }}</span>
  32. 作者: <span>{{ newsDetail.author }}</span>
  33. 发布时间: <span>{{ time }}</span>
  34. </p>
  35. </div>
  36. <div class="leftBottom" v-html="newsDetail.content" v-if="newsDetail.content" @click="openPreview">
  37. </div>
  38. <div v-if="previewVisible" class="preview-modal" @click="closePreview">
  39. <img :src="selectedImage" alt="Preview">
  40. </div>
  41. <!-- 免责声明: -->
  42. <div class="disclaimer" v-if="newsDetail.copyfrom != '本网'">
  43. <p>原文链接:{{ newsDetail.fromurl }}</p>
  44. <p>[免责声明]本文来源于网络转载,仅供学习交流使用,不构成商业目的。 版权归原作者所有,如涉及作品内容,版权和其他问题,请在30日与本网联系,我们将第一时间处理。</p>
  45. </div>
  46. <div v-if="articleChoice">
  47. <!-- 投票 start ---------------------------------------->
  48. <div class="index_3_box_vote" v-if="articleChoice">
  49. <div class="voteTitle">投票区</div>
  50. <div class="inquire">
  51. <p v-if="voteList.length > 0">{{ voteList[0].survey_name }}</p>
  52. <div class="radioBox">
  53. <!--投票选项-->
  54. <div v-if="!isDisabled">
  55. <div class="radio" v-if="isRadio">
  56. <el-radio-group v-model="radio1" @change="handleRadioChange">
  57. <el-radio v-for="item in voteList" :key="item.id" :value="item.id"
  58. size="large">
  59. <span v-if="item.is_other == 0">{{ item.choice_name }}</span>
  60. <span v-else>其他</span>
  61. </el-radio>
  62. </el-radio-group>
  63. <el-input v-if="showUserChoice" v-model="userChoice" :rows="2" type="textarea"
  64. resize="none" placeholder="请输入.." />
  65. </div>
  66. <div class="checkInputBox" v-else>
  67. <el-checkbox-group v-model="check1" @change="handleCheckboxChange">
  68. <span v-for="item in voteList" :key="item.id">
  69. <span v-if="item.is_other == 0">
  70. <el-checkbox size="large" :label="item.choice_name"
  71. :value="item.id" />
  72. </span>
  73. <span v-else>
  74. <el-checkbox size="large" label="其他" :value="item.id" />
  75. </span>
  76. </span>
  77. </el-checkbox-group>
  78. <el-input v-if="showUserChoice" v-model="userChoice" :rows="2" type="textarea"
  79. resize="none" placeholder="请输入.." />
  80. </div>
  81. </div>
  82. <!--投票结果-->
  83. <div class="inquireData" v-else>
  84. <div v-for="item in websiteSurveyData.data" :key="item.id">
  85. <div class="inquireDataItem active" v-if="item.status == 1">
  86. <div class="inquireDataItemTitle">
  87. <span v-if="item.choice_name == ''">其他</span>
  88. <span v-else>{{ item.choice_name }}</span>
  89. </div>
  90. <div class="inquireDataItemNum">{{ item.results }}票</div>
  91. </div>
  92. <div class="inquireDataItem" v-else>
  93. <div class="inquireDataItemTitle">
  94. <span v-if="item.choice_name == ''">其他</span>
  95. <span v-else>{{ item.choice_name }}</span>
  96. </div>
  97. <div class="inquireDataItemNum">{{ item.results }}票</div>
  98. </div>
  99. </div>
  100. </div>
  101. </div>
  102. <div class="btn">
  103. <button class="voting" @click="addWebsiteSurvey" :disabled="isDisabled"
  104. v-if="!isDisabled">投票</button>
  105. </div>
  106. </div>
  107. </div>
  108. <!-- 投票 end ---------------------------------------->
  109. </div>
  110. <div class="recommendRead" v-if="newsDetail.commendArticle != false">
  111. <div class="recommendReadTitle">
  112. <span class="read_title">
  113. 推荐阅读
  114. </span>
  115. </div>
  116. <div class="recommendReadList">
  117. <div class="recommendReadListTitle" v-for="(item, index) in newsDetail.commendArticle"
  118. :key="item.id">
  119. <a :href="`/${item.alias_pinyin}/${item.id}.html`" v-if="index < 3">
  120. {{ item.title }}
  121. </a>
  122. </div>
  123. </div>
  124. </div>
  125. <!--上一篇 下一篇-->
  126. <div class="prevNext">
  127. <NuxtLink to="/">上一篇:李强签署国务院令 公布《行政执法监督条例》</NuxtLink>
  128. <NuxtLink to="/">下一篇:没有了</NuxtLink>
  129. </div>
  130. </div>
  131. <div class="innerRight">
  132. <!-- 热点资讯1 -->
  133. <!-- <div class="hotList1">
  134. <DetailHotNews></DetailHotNews>
  135. </div> -->
  136. <!-- 热点资讯2 -->
  137. <div class="hotList2">
  138. <DetailHotNews2></DetailHotNews2>
  139. </div>
  140. </div>
  141. </div>
  142. </div>
  143. <!-- 页面底部 -->
  144. <HomeFoot></HomeFoot>
  145. </template>
  146. <script setup>
  147. //1.页面依赖 start ---------------------------------------->
  148. import { onMounted } from 'vue'
  149. import { ElBreadcrumb, ElBreadcrumbItem, ElRadio, ElRadioGroup, ElCheckbox, ElCheckboxGroup, ElMessage, ElInput } from 'element-plus'
  150. import { ArrowRight } from '@element-plus/icons-vue'
  151. const nuxtApp = useNuxtApp();
  152. const axios = nuxtApp.$axios;
  153. //1.1 获得跳转过来的id
  154. const route = useRoute();
  155. //获得详情id
  156. const articleId = parseInt(route.params.id); //获得该页面的id
  157. //获得当前的完整路径
  158. const fullPath = route.path;
  159. //拆分,取出来中间这一段,然后提取数字部分
  160. const segments = fullPath.split('/');
  161. const targetSegment = segments[1];
  162. // const numberPart = targetSegment.match(/\d+$/)?.[0];
  163. // let routeId = 20 //排除路径错误可以打开这个
  164. // const routeId = numberPart;
  165. let routeId;
  166. //通过导航路径反向查询导航id
  167. const getRouteId = await requestDataPromise('/web/getWebsiteRoute', {
  168. method: 'GET',
  169. query: {
  170. 'pinyin': targetSegment,
  171. },
  172. });
  173. if (getRouteId.code == 200) {
  174. routeId = getRouteId.data.category_id
  175. } else {
  176. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  177. console.log("错误位置:通过url路径查询导航池id")
  178. console.log("后端错误反馈:", getRouteId.message)
  179. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  180. }
  181. //1.2 获得父级栏目的名称、id
  182. const parent_name = ref([]);
  183. const parent_id = ref([]);
  184. const parent_pinyin = ref("");
  185. const parent_children_count = ref(0)
  186. let getParentNav = async () => {
  187. const listData = await requestDataPromise('/web/getOneWebsiteCategory', {
  188. method: 'GET',
  189. query: {
  190. 'catid': routeId
  191. },
  192. });
  193. console.log("获取父级栏目数据")
  194. console.log(listData)
  195. if (listData.code == 200) {
  196. console.log(listData.data);
  197. parent_name.value = listData.data.alias;
  198. parent_id.value = listData.data.parent_id;
  199. parent_pinyin.value = listData.data.aLIas_pinyin;
  200. parent_children_count.value = listData.data.children_count;
  201. } else {
  202. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  203. console.log("错误位置:获取面包屑导航")
  204. console.log("后端错误反馈:", listData.message)
  205. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  206. }
  207. }
  208. //获得父级栏目详情
  209. getParentNav();
  210. //1.页面依赖 end ---------------------------------------->
  211. //2.页面数据 start ---------------------------------------->
  212. //2.1 资讯详情
  213. const newsDetail = ref({})
  214. const routeNewsTtitle = ref("");
  215. //2.2 发布日期
  216. const time = ref("");
  217. //2.3 路径
  218. const routLevelTitle = ref("");
  219. const routLevelId = ref("");
  220. //是否展示投票
  221. const articleChoice = ref(false);
  222. //2.4获取详情
  223. async function getPageData() {
  224. const mkdata = await requestDataPromise('/web/selectWebsiteArticleInfo', {
  225. method: 'GET',
  226. query: {
  227. 'articleid': articleId
  228. },
  229. });
  230. if (mkdata.code == 200) {
  231. //判断是否显示投票
  232. if (mkdata.data.is_survey == 1) {
  233. console.log("本篇文章含有投票!")
  234. articleChoice.value = true;
  235. getVoteList();
  236. }
  237. //获取内容
  238. newsDetail.value = mkdata.data;
  239. //获取路径
  240. routLevelTitle.value = newsDetail.value.cat_name;
  241. routLevelId.value = newsDetail.value.category_id;
  242. //获取发布时间
  243. time.value = newsDetail.value.updated_at.split(' ')[0];
  244. //修正标题长度
  245. if (newsDetail.value.title.length >= 30) {
  246. routeNewsTtitle.value = newsDetail.value.title.substr(0, 30) + "...";
  247. } else {
  248. routeNewsTtitle.value = newsDetail.value.title
  249. }
  250. } else {
  251. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  252. console.log("错误位置:获取详情内容")
  253. console.log("后端错误反馈:", mkdata.message)
  254. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  255. }
  256. }
  257. getPageData();
  258. //2.5 获得广告
  259. //广告列表
  260. let adImg1 = ref([]);
  261. // async function getAdData(){
  262. // const adData = await requestDataPromise('/web/getWebsiteAdvertisement',{method:'GET',query:{'ad_tag':'DETAIL'}});
  263. // if(adData.code==200){
  264. // for(let item of adData.data){
  265. // if(item.ad_tag == 'DETAIL_0001'){
  266. // adImg1.value = item;
  267. // }
  268. // }
  269. // }else{
  270. // console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  271. // console.log("错误位置:获取详情页广告列表")
  272. // console.log("后端错误反馈:",adData.message)
  273. // console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  274. // }
  275. // }
  276. // getAdData();
  277. onMounted(async () => {
  278. const { $webUrl, $CwebUrl } = useNuxtApp();
  279. //广告1
  280. let url = `${$webUrl}/web/getWebsiteAdvertisement?ad_tag=snzxw_detail_0001`
  281. const responseAd1 = await fetch(url, {
  282. headers: {
  283. 'Content-Type': 'application/json',
  284. 'Userurl': $CwebUrl,
  285. 'Origin': $CwebUrl
  286. }
  287. });
  288. const resultAd1 = await responseAd1.json();
  289. adImg1.value = resultAd1.data[0];
  290. })
  291. //2.页面数据 end ---------------------------------------->
  292. //3.设置seo信息 start---------------------------------------->
  293. //3.1 设置seo信息
  294. const setData = await requestDataPromise('/web/selectWebsiteArticleInfo', {
  295. method: 'GET',
  296. query: {
  297. 'articleid': articleId
  298. },
  299. });
  300. if (setData.code == 200) {
  301. let seoTitle = setData.data.title;
  302. let seoDescription = setData.data.introduce;
  303. let seoKeywords = setData.data.keyword;
  304. let seoSuffix = setData.data.suffix;
  305. let seoName = setData.data.website_name;
  306. useSeoMeta({
  307. title: seoTitle + "_" + seoName + "_" + seoSuffix,
  308. meta: [
  309. { name: 'description', content: seoDescription + "_" + seoName + "_" + seoSuffix, tagPriority: 10 },
  310. { name: 'keywords', content: seoKeywords + "_" + seoName + "_" + seoSuffix, tagPriority: 10 },
  311. { name: 'viewport', content: 'width=device-width,initial-scale=1,user-scalable=no', tagPriority: 10 }
  312. ]
  313. });
  314. } else {
  315. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  316. console.log("错误位置:设置详情页面SEO数据")
  317. console.log("后端错误反馈:", setData.message)
  318. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  319. }
  320. //3.设置seo信息 end---------------------------------------->
  321. //4.投票 start---------------------------------------->
  322. const radio1 = ref(''); //单选
  323. const check1 = ref([]); //多选
  324. const isDisabled = ref(false);//是否禁用提交按钮
  325. const isRadio = ref(true);//是否渲染单选
  326. const userSurId = ref('');//投票属于哪一篇文章
  327. const userChoice = ref('');//用于判断用户选择了其他选项以后,输入的值
  328. const userIsChoice = ref('');//用于判断其他选项目前是什么值
  329. const showUserChoice = ref(false);//是否显示其他输入框
  330. const websiteSurveyData = ref([]);//投票结果
  331. //3.2获得投票列表
  332. let voteList = ref([]);
  333. async function getVoteList() {
  334. const voteData = await requestHome('/web/getWebsiteSurvey', { method: 'GET', query: { 'art_id': articleId } });
  335. console.log(778899)
  336. console.log(voteData)
  337. if (voteData.code == 200) {
  338. voteList.value = voteData.data;
  339. console.log(voteList.value)
  340. //判断显示单选还是多选
  341. //survey_type 0是单选 1是多选
  342. if (voteData.data[0].survey_type == 0) {
  343. isRadio.value = true;
  344. console.log("1111")
  345. } else {
  346. isRadio.value = false;
  347. }
  348. //把最后一个的值拿出来 用于判断用户是否选择了其他
  349. for (let item of voteData.data) {
  350. //如果含有其他
  351. if (item.is_other == 1) {
  352. userIsChoice.value = item.id;
  353. }
  354. }
  355. //用户投票属于哪一篇文章
  356. userSurId.value = voteData.data[0].sur_id;
  357. } else {
  358. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  359. console.log("错误位置:首页投票")
  360. console.log("后端错误反馈:", voteData.message)
  361. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  362. }
  363. }
  364. //3.2当用户选择了选项,判断是否展示其他输入框
  365. const handleRadioChange = (value) => {
  366. if (value == userIsChoice.value) {
  367. showUserChoice.value = true;
  368. } else {
  369. showUserChoice.value = false;
  370. }
  371. }
  372. const handleCheckboxChange = (value) => {
  373. if (value.includes(userIsChoice.value)) {
  374. showUserChoice.value = true;
  375. } else {
  376. showUserChoice.value = false;
  377. }
  378. }
  379. //3.2发起投票
  380. async function addWebsiteSurvey() {
  381. //判断当前是单选还是多选
  382. console.log(isRadio.value)
  383. if (isRadio.value) {
  384. console.log("用户单选!")
  385. if (radio1.value != '') {
  386. //先判断一下是否使用了其他选项
  387. if (showUserChoice.value) {
  388. if (userChoice.value != '') {
  389. //文章id
  390. // console.log(userSurId.value)
  391. // 用户输入的值
  392. // console.log(userChoice.value)
  393. //如果使用了其他,其他的选项需要增加进去
  394. const ChoiceData = await requestHome('/web/addWebsiteSurveyOption', {
  395. method: 'GET',
  396. query: {
  397. 'sur_id': userSurId.value,//投票的新闻id
  398. 'choice_name': userChoice.value,//投票的选项id
  399. }
  400. });
  401. if (ChoiceData.code == 200) {
  402. //提交完其他选项以后,再正式发起投票
  403. const mkData = await requestHome('/web/addWebsiteSurveyVote', {
  404. method: 'GET',
  405. query: {
  406. 'sur_id': userSurId.value,
  407. 'choice_id': ChoiceData.data
  408. }
  409. });
  410. if (mkData.code == 200) {
  411. ElMessage.success('投票成功!')
  412. //把投票结果显示到页面上 禁用投票按钮
  413. isDisabled.value = true;
  414. websiteSurveyData.value = mkData.data;
  415. //遍历一下,把用户选中的那个设置status为1
  416. let data = mkData.data;
  417. //遍历一下,把用户选中的那个设置status为1
  418. for (let item of data.data) {
  419. for (let i of data.choice) {
  420. if (item.id == i) {
  421. console.log(item.id)
  422. item.status = 1;
  423. }
  424. }
  425. }
  426. websiteSurveyData.value = data;
  427. } else {
  428. ElMessage.error(mkData.message)
  429. }
  430. } else {
  431. ElMessage.error('其他投票失败!')
  432. }
  433. } else {
  434. ElMessage.error('请输入选项内容!')
  435. }
  436. } else {
  437. //如果没选择其他,直接提交选择的内容
  438. const mkData = await requestHome('/web/addWebsiteSurveyVote', {
  439. method: 'GET',
  440. query: {
  441. 'sur_id': userSurId.value,
  442. 'choice_id': radio1.value
  443. }
  444. });
  445. if (mkData.code == 200) {
  446. ElMessage.success('投票成功!')
  447. //把投票结果显示到页面上 禁用投票按钮
  448. isDisabled.value = true;
  449. let data = mkData.data;
  450. //遍历一下,把用户选中的那个设置status为1
  451. for (let item of data.data) {
  452. for (let i of data.choice) {
  453. if (item.id == i) {
  454. item.status = 1;
  455. }
  456. }
  457. }
  458. websiteSurveyData.value = data;
  459. } else {
  460. ElMessage.error('投票失败!')
  461. }
  462. }
  463. } else {
  464. ElMessage.error('请选择一个选项')
  465. }
  466. } else {
  467. console.log("多选!")
  468. //多选
  469. if (check1.value != []) {
  470. //先判断一下是否使用了其他选项
  471. if (showUserChoice.value) {
  472. if (userChoice.value != '') {
  473. //判断用户是否只选择了一个其他
  474. if (check1.value.length == 1) {
  475. const ChoiceData = await requestDataPromise('/web/addWebsiteSurveyOption', {
  476. method: 'GET',
  477. query: {
  478. 'sur_id': userSurId.value,//投票的新闻id
  479. 'choice_name': userChoice.value,//用户输入的其他选项文字
  480. }
  481. });
  482. if (ChoiceData.code == 200) {
  483. //提交完其他选项以后,再正式发起投票
  484. const mkData = await requestDataPromise('/web/addWebsiteSurveyVote', {
  485. method: 'GET',
  486. query: {
  487. 'sur_id': userSurId.value,
  488. 'choice_id': ChoiceData.data
  489. }
  490. });
  491. if (mkData.code == 200) {
  492. ElMessage.success('投票成功!')
  493. //把投票结果显示到页面上 禁用投票按钮
  494. isDisabled.value = true;
  495. websiteSurveyData.value = mkData.data;
  496. //遍历一下,把用户选中的那个设置status为1
  497. let data = mkData.data;
  498. //遍历一下,把用户选中的那个设置status为1
  499. for (let item of data.data) {
  500. for (let i of data.choice) {
  501. if (item.id == i) {
  502. console.log(item.id)
  503. item.status = 1;
  504. }
  505. }
  506. }
  507. websiteSurveyData.value = data;
  508. } else {
  509. ElMessage.error(mkData.message)
  510. }
  511. } else {
  512. ElMessage.error('其他投票失败!')
  513. }
  514. } else {
  515. //用户选择了除了其他以外,还包括别的选项
  516. const ChoiceData = await requestDataPromise('/web/addWebsiteSurveyOption', {
  517. method: 'GET',
  518. query: {
  519. 'sur_id': userSurId.value,//投票的新闻id
  520. 'choice_name': userChoice.value,//用户输入的其他选项文字
  521. }
  522. });
  523. if (ChoiceData.code == 200) {
  524. let data = check1.value;
  525. //找到多选的数组,把其他默认值给替换掉
  526. for (let i = 0; i < data.length; i++) {
  527. if (data[i] == userIsChoice.value) {
  528. data[i] = ChoiceData.data;
  529. }
  530. }
  531. let jsonArray = JSON.stringify(data);
  532. //提交完其他选项以后,再正式发起投票
  533. const mkData = await requestDataPromise('/web/addWebsiteSurveyVote', {
  534. method: 'GET',
  535. query: {
  536. 'sur_id': userSurId.value,
  537. 'choice_id': jsonArray
  538. }
  539. });
  540. if (mkData.code == 200) {
  541. ElMessage.success('投票成功!')
  542. //把投票结果显示到页面上 禁用投票按钮
  543. isDisabled.value = true;
  544. websiteSurveyData.value = mkData.data;
  545. //遍历一下,把用户选中的那个设置status为1
  546. let data = mkData.data;
  547. //遍历一下,把用户选中的那个设置status为1
  548. for (let item of data.data) {
  549. for (let i of data.choice) {
  550. if (item.id == i) {
  551. //console.log(item.id)
  552. item.status = 1;
  553. }
  554. }
  555. }
  556. websiteSurveyData.value = data;
  557. } else {
  558. ElMessage.error(mkData.message)
  559. }
  560. } else {
  561. ElMessage.error('其他投票失败!')
  562. }
  563. }
  564. } else {
  565. ElMessage.error('请输入选项内容!')
  566. }
  567. } else {
  568. let jsonArray = JSON.stringify(check1.value);
  569. //如果没选择其他,直接提交选择的内容
  570. const mkData = await requestDataPromise('/web/addWebsiteSurveyVote', {
  571. method: 'GET',
  572. query: {
  573. 'sur_id': userSurId.value,
  574. 'choice_id': jsonArray
  575. }
  576. });
  577. if (mkData.code == 200) {
  578. ElMessage.success('投票成功!')
  579. //把投票结果显示到页面上 禁用投票按钮
  580. isDisabled.value = true;
  581. websiteSurveyData.value = mkData.data;
  582. //遍历一下,把用户选中的那个设置status为1
  583. let data = mkData.data;
  584. //遍历一下,把用户选中的那个设置status为1
  585. for (let item of data.data) {
  586. for (let i of data.choice) {
  587. if (item.id == i) {
  588. console.log(item.id)
  589. item.status = 1;
  590. }
  591. }
  592. }
  593. websiteSurveyData.value = data;
  594. } else {
  595. ElMessage.error('投票失败!')
  596. }
  597. }
  598. } else {
  599. ElMessage.error('请选择一个选项')
  600. }
  601. }
  602. }
  603. //4.投票 end---------------------------------------->
  604. //5.页面图片放大 start---------------------------------------->
  605. const previewVisible = ref(false)
  606. const selectedImage = ref(' ')
  607. const openPreview = (event) => {
  608. if (event.target.tagName === 'IMG') {
  609. selectedImage.value = event.target.src;
  610. previewVisible.value = true;
  611. }
  612. }
  613. const closePreview = () => {
  614. previewVisible.value = false;
  615. }
  616. //5.页面图片放大 end---------------------------------------->
  617. </script>
  618. <style lang="less" scoped>
  619. //@import url('@/assets/css/article/pc.less');
  620. //@import url('@/assets/css/article/yd.less');
  621. //面包屑
  622. .breadcrumb-box {
  623. width: 1400PX;
  624. margin: 0 auto;
  625. .inner {
  626. width: 100%;
  627. height: 22PX;
  628. margin-top: 20PX;
  629. margin-bottom: 20PX;
  630. font-family: Microsoft YaHei, Microsoft YaHei;
  631. font-weight: 400;
  632. font-size: 20PX;
  633. color: #666666;
  634. line-height: 23PX;
  635. text-align: left;
  636. font-style: normal;
  637. text-transform: none;
  638. display: flex;
  639. align-items: center;
  640. border-bottom: 1PX dashed #ccc;
  641. margin-bottom: 10PX;
  642. padding: 20PX 20PX 20PX 0;
  643. box-sizing: border-box;
  644. a {
  645. font-size: 16PX;
  646. color: #000;
  647. line-height: 20PX;
  648. }
  649. span {
  650. font-size: 16PX;
  651. color: #000;
  652. line-height: 20PX;
  653. &.location {
  654. line-height: 20PX;
  655. }
  656. }
  657. }
  658. }
  659. //资讯详情
  660. .newsDetail {
  661. width: 100%;
  662. margin-bottom: 10PX;
  663. .inner {
  664. width: 1400PX;
  665. overflow: hidden;
  666. font-size: 16PX;
  667. display: flex;
  668. align-items: flex-start;
  669. justify-content: space-between;
  670. .innerLeft {
  671. width: 1030PX;
  672. .LeftTop {
  673. margin-top: 20PX;
  674. border-bottom: 1PX dashed #ccc;
  675. padding-bottom: 20PX;
  676. >h1 {
  677. line-height: 40PX;
  678. margin-bottom: 20PX;
  679. font-family: Microsoft YaHei, Microsoft YaHei;
  680. font-weight: bold;
  681. font-size: 24PX;
  682. color: #333333;
  683. text-align: center;
  684. }
  685. >p {
  686. height: 18PX;
  687. line-height: 18PX;
  688. font-family: Microsoft YaHei, Microsoft YaHei;
  689. font-weight: 400;
  690. font-size: 14PX;
  691. color: #999999;
  692. text-align: center;
  693. span {
  694. margin-right: 40PX;
  695. }
  696. }
  697. >img {
  698. width: 680PX;
  699. height: 382PX;
  700. padding: 50PX 0PX 60PX 55PX;
  701. }
  702. }
  703. .leftBottom {
  704. margin-top: 20PX;
  705. font-size: 20PX;
  706. line-height: 38PX;
  707. margin-bottom: 30PX;
  708. word-break: break-all;
  709. ul>li img {
  710. width: 790PX;
  711. height: 382PX;
  712. }
  713. img {
  714. width: 790PX;
  715. height: 382PX;
  716. }
  717. p.tinymce-material {
  718. img {
  719. width: 790PX;
  720. }
  721. }
  722. >h3,
  723. >p {
  724. text-indent: 2em;
  725. width: 790PX;
  726. font-family: Microsoft YaHei, Microsoft YaHei;
  727. font-size: 20PX;
  728. color: #333333;
  729. line-height: 38PX;
  730. padding-bottom: 30PX;
  731. img {
  732. width: 790PX;
  733. }
  734. }
  735. >h3 {
  736. font-weight: 600PX;
  737. }
  738. >p {
  739. font-weight: 400;
  740. }
  741. }
  742. .disclaimer {
  743. width: 790PX;
  744. overflow: hidden;
  745. border-top: 1PX solid #e6e6e6;
  746. padding: 30PX 0PX;
  747. color: #999999;
  748. font-size: 17PX;
  749. p {
  750. width: 790PX;
  751. line-height: 30PX;
  752. }
  753. }
  754. .recommendRead {
  755. width: 100%;
  756. margin: 30PX 0PX 20PX 0;
  757. .recommendReadTitle {
  758. font-size: 18PX;
  759. color: #001996;
  760. height: 42PX;
  761. line-height: 35PX;
  762. letter-spacing: 1PX;
  763. text-align: left;
  764. font-style: normal;
  765. text-transform: none;
  766. border-bottom: 1PX solid #D9D9D9;
  767. .read_title {
  768. display: inline-block;
  769. text-align: center;
  770. width: 94PX;
  771. height: 40PX;
  772. border-bottom: 2PX solid #158d91;
  773. }
  774. }
  775. .recommendReadList {
  776. min-height: 155PX;
  777. margin-top: 20PX;
  778. padding-bottom: 10PX;
  779. font-size: 16PX;
  780. border-bottom: 1PX solid #D9D9D9;
  781. .recommendReadListTitle {
  782. margin-top: 18PX;
  783. a {
  784. &:hover {
  785. color: #158d91;
  786. }
  787. color: #333333;
  788. }
  789. }
  790. .recommendReadListTitle:nth-child(1)::after {
  791. content: "热";
  792. margin-left: 13PX;
  793. background: #FF8A37;
  794. color: #fff;
  795. font-size: 14PX;
  796. padding: 0PX 2PX;
  797. }
  798. .recommendReadListTitle:hover a {
  799. color: #158d91;
  800. }
  801. }
  802. }
  803. }
  804. .innerRight {
  805. width: 315PX;
  806. overflow: hidden;
  807. border-top: 1PX solid #139602;
  808. .hotList1 {
  809. margin-bottom: 50PX;
  810. }
  811. }
  812. }
  813. }
  814. .leftBottom::v-deep p img,
  815. .leftBottom::v-deep img,
  816. .leftBottom::v-deep video {
  817. max-width: 700px;
  818. }
  819. .leftBottom::v-deep h1,
  820. .leftBottom::v-deep h2,
  821. .leftBottom::v-deep h3,
  822. .leftBottom::v-deep h4,
  823. .leftBottom::v-deep h5,
  824. .leftBottom::v-deep h6 {
  825. font-size: 20px;
  826. font-weight: 500;
  827. }
  828. //投票
  829. .index_3_box_vote {
  830. .voteTitle {
  831. font-size: 20px;
  832. height: 40px;
  833. line-height: 40px;
  834. color: #333333;
  835. padding-left: 20px;
  836. width: 100%;
  837. border-bottom: 1px solid #E7E7E7;
  838. border-top: 1px solid #139602;
  839. box-sizing: border-box;
  840. }
  841. width:100%;
  842. box-sizing:border-box;
  843. border:solid 1px #FBFBFB;
  844. background: #FBFBFB;
  845. .inquire {
  846. height: 394px;
  847. margin-top: 20px;
  848. border-radius: 6px 6px 6px 6px;
  849. padding: 4px 40px 4px 6px;
  850. box-sizing: border-box;
  851. p {
  852. font-weight: bold;
  853. height: 69px;
  854. font-family: PingFang SC, PingFang SC;
  855. font-size: 20px;
  856. color: #333333;
  857. line-height: 21px;
  858. text-align: left;
  859. font-style: normal;
  860. text-transform: none;
  861. padding: 12px 20px 0 32px;
  862. }
  863. .radioBox {
  864. height: 250px;
  865. padding-left: 30px;
  866. overflow-y: auto;
  867. box-sizing: border-box;
  868. padding-bottom: 20px;
  869. }
  870. .radio {
  871. /deep/.el-radio {
  872. --el-radio-input-border-color-hover: #27881a;
  873. }
  874. /deep/.el-radio-group {
  875. align-items: center;
  876. display: inline-flex;
  877. flex-wrap: wrap;
  878. font-size: 0;
  879. //padding-left: 35px;
  880. }
  881. /deep/.el-radio.el-radio--large {
  882. width: 100%;
  883. height: 29px;
  884. margin-bottom: 15px;
  885. }
  886. /deep/.el-radio.el-radio--large .el-radio__label {
  887. font-family: PingFang SC, PingFang SC;
  888. font-weight: 400;
  889. font-size: 16px;
  890. color: #333333;
  891. white-space: nowrap;
  892. overflow: hidden;
  893. text-overflow: ellipsis;
  894. width: 300px;
  895. }
  896. /deep/.el-radio.el-radio--large .el-radio__inner {
  897. height: 16px;
  898. width: 16px;
  899. }
  900. /deep/.el-radio__input.is-checked+.el-radio__label {
  901. color: #27881a;
  902. }
  903. /deep/.el-radio__input.is-checked .el-radio__inner {
  904. background: #33b023;
  905. border-color: #27881a;
  906. }
  907. }
  908. .checkInputBox {
  909. /deep/.el-checkbox {
  910. --el-radio-input-border-color-hover: #27881a;
  911. }
  912. /deep/.el-checkbox-group {
  913. align-items: center;
  914. display: inline-flex;
  915. flex-wrap: wrap;
  916. font-size: 0;
  917. //padding-left: 35px;
  918. }
  919. /deep/.el-checkbox.el-checkbox--large {
  920. width: 330px;
  921. height: 29px;
  922. margin-bottom: 15px;
  923. }
  924. /deep/.el-checkbox.el-checkbox--large .el-checkbox__label {
  925. font-family: PingFang SC, PingFang SC;
  926. font-weight: 400;
  927. font-size: 16px;
  928. color: #333333;
  929. white-space: nowrap;
  930. overflow: hidden;
  931. text-overflow: ellipsis;
  932. width: 300px;
  933. }
  934. /deep/.el-checkbox.el-checkbox--large .el-checkbox__inner {
  935. height: 16px;
  936. width: 16px;
  937. }
  938. /deep/.el-checkbox__input.is-checked+.el-checkbox__label {
  939. color: #27881a;
  940. }
  941. /deep/.el-checkbox__input.is-checked .el-checkbox__inner {
  942. background: #33b023;
  943. border-color: #27881a;
  944. }
  945. }
  946. .btn {
  947. padding-left: 30px;
  948. button {
  949. width: 78px;
  950. height: 37px;
  951. line-height: 37px;
  952. border-radius: 6px;
  953. border: none;
  954. font-family: PingFang SC, PingFang SC;
  955. font-weight: 400;
  956. font-size: 16px;
  957. color: #999999;
  958. }
  959. .voting {
  960. background-color: #49A769;
  961. color: #fff;
  962. margin-right: 44px;
  963. cursor: pointer;
  964. }
  965. .look {
  966. cursor: pointer;
  967. }
  968. }
  969. }
  970. .inquireData {
  971. .inquireDataItem {
  972. width: 100%;
  973. height: 38px;
  974. display: flex;
  975. align-items: center;
  976. justify-content: space-between;
  977. background: #F3F3F3;
  978. border: 1px solid #D2D2D2;
  979. margin-bottom: 10px;
  980. border-radius: 6px;
  981. padding: 0 15px;
  982. box-sizing: border-box;
  983. color: #999999;
  984. .inquireDataItemTitle {
  985. width: 290px;
  986. height: 38px;
  987. font-size: 16px;
  988. line-height: 38px;
  989. white-space: nowrap;
  990. overflow: hidden;
  991. text-overflow: ellipsis;
  992. }
  993. .inquireDataItemNum {
  994. font-size: 16px;
  995. }
  996. }
  997. .active {
  998. color: #49A769;
  999. background: #dff7e8;
  1000. border: 1px solid #49A769;
  1001. }
  1002. }
  1003. }
  1004. //放大图片
  1005. .preview-modal {
  1006. position: fixed;
  1007. top: 0;
  1008. left: 0;
  1009. width: 100%;
  1010. height: 100%;
  1011. background: rgba(0, 0, 0, 0.8);
  1012. display: flex;
  1013. justify-content: center;
  1014. align-items: center;
  1015. z-index: 1000;
  1016. }
  1017. .preview-modal img {
  1018. max-width: 100%;
  1019. max-height: 100%;
  1020. cursor: pointer;
  1021. }
  1022. //上一篇 下一篇
  1023. .prevNext {
  1024. border-bottom: 1px solid #ccc;
  1025. padding-bottom: 10px;
  1026. a {
  1027. display: block;
  1028. color: #333;
  1029. font-size: 15px;
  1030. display: block;
  1031. height: 40px;
  1032. line-height: 40px;
  1033. &:hover {
  1034. color: #0071B7;
  1035. }
  1036. }
  1037. }
  1038. .breadcrumb-box {
  1039. width: 1400PX;
  1040. margin: 0px auto 0px;
  1041. }
  1042. .el-breadcrumb {
  1043. height: 22PX;
  1044. line-height: 22PX;
  1045. }
  1046. .breadcrumb-box .inner span.location {
  1047. font-size: 16PX;
  1048. ;
  1049. height: 22PX;
  1050. ;
  1051. line-height: 22PX;
  1052. font-weight: normal;
  1053. word-break: keep-all;
  1054. white-space: nowrap;
  1055. }
  1056. .breadcrumb-box .inner a {
  1057. font-size: 16PX;
  1058. ;
  1059. height: 22PX;
  1060. line-height: 22PX;
  1061. display: inline-block;
  1062. font-weight: normal;
  1063. }
  1064. .breadcrumb-box .phone_breadcrumb_text /deep/.el-breadcrumb__inner {
  1065. font-size: 16PX;
  1066. ;
  1067. height: 22PX;
  1068. line-height: 22PX;
  1069. font-weight: normal;
  1070. }
  1071. .breadcrumb-box:deep(.el-icon) {
  1072. width: 16PX;
  1073. height: 16PX;
  1074. }
  1075. .breadcrumb-box .inner span {
  1076. font-size: 16PX;
  1077. height: 22PX;
  1078. line-height: 22PX;
  1079. }
  1080. .el-breadcrumb__inner {}
  1081. .newsDetail {
  1082. box-sizing: border-box;
  1083. overflow: hidden;
  1084. width: 1400PX;
  1085. margin: 0px auto 0px;
  1086. }
  1087. .newsDetail .inner {
  1088. display: block;
  1089. overflow: hidden;
  1090. width: 100%;
  1091. }
  1092. .newsDetail .inner .innerLeft .LeftTop>h1 {
  1093. font-size: 24PX;
  1094. line-height: 33PX;
  1095. }
  1096. .newsDetail .inner .innerLeft .LeftTop>p span {
  1097. font-size: 14PX;
  1098. }
  1099. .newsDetail .inner .innerLeft .leftBottom {
  1100. font-size: 18PX;
  1101. line-height: 22px;
  1102. }
  1103. .newsDetail .inner .innerLeft .recommendRead .recommendReadTitle {
  1104. height: 33PX;
  1105. line-height: 33PX;
  1106. }
  1107. .newsDetail .inner .innerLeft .recommendRead .recommendReadTitle .read_title {
  1108. height: 33PX;
  1109. line-height: 33PX;
  1110. font-size: 16PX;
  1111. width: auto;
  1112. box-sizing: border-box;
  1113. float: left;
  1114. }
  1115. .newsDetail .inner .innerLeft {
  1116. float: left;
  1117. width: 64%;
  1118. overflow: hidden;
  1119. margin-right: 0px;
  1120. }
  1121. .newsDetail .inner .innerRight {
  1122. float: right;
  1123. width: 33%;
  1124. overflow: hidden;
  1125. }
  1126. .innerRight .hotList2 {
  1127. width: 100%;
  1128. }
  1129. .newsDetail .inner .innerLeft .LeftTop>p {
  1130. font-size: 14PX;
  1131. }
  1132. .newsDetail .inner .innerLeft .recommendRead .recommendReadList {}
  1133. .newsDetail .inner .innerLeft .recommendRead .recommendReadList .recommendReadListTitle {
  1134. line-height: 33PX;
  1135. height: 33PX;
  1136. }
  1137. .newsDetail .inner .innerLeft .recommendRead .recommendReadList .recommendReadListTitle a {
  1138. line-height: 33PX;
  1139. height: 33PX;
  1140. padding-right: 22PX;
  1141. box-sizing: border-box;
  1142. font-size: 16PX;
  1143. width: 90%;
  1144. float: left;
  1145. display: block;
  1146. word-break: keep-all;
  1147. white-space: nowrap;
  1148. overflow: hidden;
  1149. text-overflow: ellipsis;
  1150. }
  1151. .newsDetail .inner .innerLeft .recommendRead .recommendReadList .recommendReadListTitle:nth-child(1)::after {
  1152. font-size: 14PX;
  1153. margin-top: 1PX;
  1154. }
  1155. .prevNext a {
  1156. height: 22PX;
  1157. line-height: 22PX;
  1158. font-size: 14PX;
  1159. width: 100%;
  1160. display: block;
  1161. word-break: keep-all;
  1162. white-space: nowrap;
  1163. overflow: hidden;
  1164. text-overflow: ellipsis;
  1165. }
  1166. @media screen and (min-width: 1401px) {
  1167. //你的样式
  1168. }
  1169. @media screen and (max-width: 1400px) {
  1170. .breadcrumb-box {
  1171. width: 100%;
  1172. margin: 0px auto 0px;
  1173. box-sizing: border-box;
  1174. padding: 0px 10px;
  1175. }
  1176. .newsDetail {
  1177. width: 100%;
  1178. margin: 0px auto 0px;
  1179. box-sizing: border-box;
  1180. padding: 0px 10px;
  1181. overflow: hidden;
  1182. }
  1183. }
  1184. @media screen and (min-width: 801px) and (max-width: 1400px) {
  1185. //你的样式
  1186. }
  1187. @media screen and (max-width: 800px) {
  1188. //你的样式
  1189. .newsDetail .inner {
  1190. display: block;
  1191. width: 100%;
  1192. }
  1193. .newsDetail .inner .innerLeft {
  1194. width: 100%;
  1195. }
  1196. .newsDetail .inner .innerRight {
  1197. width: 100%;
  1198. }
  1199. .breadcrumb-box .phone_breadcrumb_text /deep/.el-breadcrumb__inner {
  1200. width: 100PX;
  1201. display: block;
  1202. word-break: keep-all;
  1203. white-space: nowrap;
  1204. overflow: hidden;
  1205. text-overflow: ellipsis;
  1206. }
  1207. .newsDetail .inner .innerLeft .recommendRead .recommendReadTitle .read_title {
  1208. width: auto;
  1209. }
  1210. .newsDetail .inner .innerLeft .leftBottom {
  1211. line-height: 33PX;
  1212. }
  1213. .breadcrumb-box :deep(.el-icon) {}
  1214. .breadcrumb-box .inner span.location,
  1215. .breadcrumb-box .inner span {
  1216. font-size: 24px;
  1217. }
  1218. .breadcrumb-box .inner a {
  1219. font-size: 24px;
  1220. height: 55px;
  1221. line-height: 55px;
  1222. }
  1223. .breadcrumb-box .phone_breadcrumb_text :deep(.el-breadcrumb__inner) {
  1224. font-size: 24px;
  1225. height: 55px;
  1226. line-height: 55px;
  1227. }
  1228. .newsDetail .inner .innerLeft .LeftTop>h1 {
  1229. font-size: 24PX;
  1230. line-height: 33PX;
  1231. }
  1232. .newsDetail .inner .innerLeft .LeftTop>h1 {
  1233. font-size: 33px;
  1234. line-height: 44px;
  1235. }
  1236. .newsDetail .inner .innerLeft .LeftTop>p {
  1237. font-size: 14px;
  1238. line-height: 24px;
  1239. height: auto;
  1240. }
  1241. .newsDetail .inner .innerLeft .LeftTop>p span {
  1242. font-size: 14px;
  1243. line-height: 24px;
  1244. height: auto;
  1245. }
  1246. .newsDetail .inner .innerLeft .leftBottom {
  1247. font-size: 26px;
  1248. line-height: 44px;
  1249. }
  1250. .newsDetail .inner .innerLeft .recommendRead .recommendReadTitle {
  1251. height: auto;
  1252. overflow: hidden;
  1253. }
  1254. .newsDetail .inner .innerLeft .recommendRead .recommendReadTitle .read_title {
  1255. height: 44px;
  1256. line-height: 44px;
  1257. font-size: 28px;
  1258. }
  1259. .newsDetail .inner .innerLeft .recommendRead .recommendReadList .recommendReadListTitle {
  1260. line-height: 44px;
  1261. height: 44px;
  1262. }
  1263. .newsDetail .inner .innerLeft .recommendRead .recommendReadList .recommendReadListTitle a {
  1264. line-height: 44px;
  1265. height: 44px;
  1266. font-size: 24px;
  1267. }
  1268. .newsDetail .inner .innerLeft .recommendRead .recommendReadList .recommendReadListTitle:nth-child(1)::after {
  1269. font-size: 14PX;
  1270. margin-top: 1PX;
  1271. }
  1272. .prevNext a {
  1273. height: 44px;
  1274. line-height: 44px;
  1275. font-size: 24px;
  1276. }
  1277. }
  1278. </style>